/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package simulation;

import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author Danielondon
 */
public class ChargeStrategyFactory {
    public static List<String> CHARGE_STRATEGIES;
    private static String SIMPLEX_OPTIMIZATION ="GLPK-Simplex";
    private static String SIMPLEX_OPTIMIZATION_LPSOLVER ="LPSolver-Simplex";
    private static String SIMPLE_STRATEGY ="Manual";
    static {
        CHARGE_STRATEGIES = new ArrayList();
        CHARGE_STRATEGIES.add(SIMPLEX_OPTIMIZATION_LPSOLVER);
        CHARGE_STRATEGIES.add(SIMPLEX_OPTIMIZATION);
        //CHARGE_STRATEGIES.add(SIMPLE_STRATEGY);
        
    }
    
    public static IChargeStrategy createChargeStrategy(String strategyName, int slotSize, String carName) throws Exception{
        
        if (strategyName.equals(SIMPLE_STRATEGY)) {
            return new SimpleChargeStrategy(slotSize, carName);
        }
        
        if (strategyName.equals(SIMPLEX_OPTIMIZATION)) {
            return new GreedyChargeStrategy(slotSize, carName, SolverType.GLPK);
        }
        
        if (strategyName.equals(SIMPLEX_OPTIMIZATION_LPSOLVER)) {
            return new GreedyChargeStrategy(slotSize, carName, SolverType.LPSolver);
        }
        
        throw new Exception("Invalid selection of Strategy. There is no strategy " + strategyName);
    }
}
